package com.games.chaoshi;

import java.util.Scanner;

import static com.games.chaoshi.ConstantSup.zhanghao;

//模拟界面
public class UI {

    Scanner input = new Scanner(System.in);
    CashManager cm = new CashManager();
    StoreManager sm = new StoreManager();

    boolean r = true;

    public void start() {
        System.out.println("欢迎登陆铁蛋超市收银系统");
        do {
            System.out.println("请输入管理账号：");

            if (input.hasNextInt()) {
                String j = input.next();
                if (j.equals(zhanghao)) {
                    System.out.println("登录账号成功！");
                    System.out.println("请选择：  1.入库管理 2.结账管理     3.退出");
                    int i = input.nextInt();

                    switch (i) {
                        case 1:
                            sm.startStore();
                            start();    //为了做一次循环！！！再次回到"欢迎登陆卖的好超市收银系统"...
                            break;
                        case 2:
                            cm.startCash();
                            break;
                        case 3:
                            System.out.println("欢迎再次光临铁蛋超市");
                            break;

                    }

                    r = false;

                } else {
                    System.out.println("账号输入不正确，请输入正确的登录账号：");
                }
            } else {
                System.out.println("登录账号为一组数字！请输入数字");
            }

        } while (r);
    }
}
